home *** CD-ROM | disk | FTP | other *** search
/ Chip 1996 November / Chip 11-96.iso / workshop / howto / busmouse < prev    next >
Text File  |  1996-09-04  |  18KB  |  449 lines

  1.   The Linux Busmouse Howto
  2.   Mike Battersby, mib@deakin.edu.au
  3.   v1.2, 2 August 1994
  4.  
  5.   1.  Introduction.
  6.  
  7.   This document is a guide to getting your busmouse working with Linux.
  8.   I've written this in the hope that the ten people a week who post
  9.   ``how do I get my busmouse to work'' questions in the comp.os.linux.*
  10.   newsgroups will read it first, though I won't be holding my breath.
  11.  
  12.   Busmouse support has been in the kernel for as long as I can remember,
  13.   and hasn't changed in a long time, so this document should be relevant
  14.   to any version of Linux you're likely to have.
  15.  
  16.   1.1.  Disclaimer.
  17.  
  18.   The information in this document is correct to the best of my
  19.   knowledge, but there's a always a chance I've made some mistakes, so
  20.   don't follow everything too blindly, especially if it seems wrong.
  21.   Nothing here should have a detrimental effect on your computer, but
  22.   just in case I take no responsibility for any damages incurred from
  23.   the use of the information contained herein.
  24.  
  25.   Microsoft(R) is a Trademark of Microsoft Corporation.
  26.  
  27.   [ trademark notices for other mice, anyone? --- Mike ]
  28.  
  29.   1.2.  Feedback.
  30.  
  31.   If you find any mistakes in this document, have any comments about its
  32.   contents or an update or addition, send them to me at the address
  33.   listed at the top of this howto.
  34.  
  35.   1.3.  Acknowledgements.
  36.  
  37.   This howto has been, in the spirit of Linux, a community effort.  Many
  38.   thanks go to Johan Myreen for the sections on the PS/2 mice, Robert T.
  39.   Harris for help on the ATI-XL sections and Reuben Sumner for
  40.   miscellaneous info and constructive criticism.
  41.  
  42.   Thanks also to the multitudes of people who have sent me mouse
  43.   information, fixes or words of encouragement.
  44.  
  45.   2.  Determining your mouse type.
  46.  
  47.   There are two separate but important characteristics you will need to
  48.   know about your mouse before you go on: what interface it uses and
  49.   what protocol it uses.  The interface is the hardware aspect of the
  50.   mouse, taking into account things like which i/o ports it uses and how
  51.   to check if it is installed.  This is the part which the kernel is
  52.   concerned with, so that it knows how to read data from the mouse.  The
  53.   protocol is the software aspect of the mouse.  Applications need to
  54.   know the protocol to interpret the raw mouse data they receive from
  55.   the kernel.
  56.  
  57.   2.1.  Mouse interfaces.
  58.  
  59.   The Linux kernel currently supports four different kinds of bus mouse
  60.   interface : Inport (Microsoft), Logitech, PS/2 and ATI-XL.  The
  61.   majority of bus mice have Inport interfaces, although lately PS/2
  62.   interfaces are becoming more popular.  There is no surefire way of
  63.   determining your mouse interface --- mouse developers generally do
  64.   their own thing when it comes to standards.  The following sections
  65.   may help, otherwise you'll just have to make it up.
  66.  
  67.   2.2.  Inport mice.
  68.  
  69.   This includes most of the old style Microsoft mice which are shaped
  70.   like a bar of dove soap.  U.S. users who have purchased Gateway
  71.   computers should note that the mice that come with them are not Inport
  72.   mice but PS/2 mice (see below).  Inport mice generally connect to an
  73.   interface card which plugs into the bus on your motherboard.  If the
  74.   plug which connects your mouse cord to the interface card is round,
  75.   has 9 pins, and a notch in one side you likely have an Inport mouse.
  76.  
  77.   As far as I can tell, apart from the ATI-XL, all ATI mice (such as
  78.   those on the Graphics Ultra cards) are plain Inport mice.
  79.  
  80.   2.3.  Logitech mice.
  81.  
  82.   Logitech mice in general appear almost exactly the same as Inport
  83.   mice.  They too connect to an interface card via a 9 pin mini-din
  84.   connector.  Hopefully, it will have come in a Logitech box or have
  85.   ``Logitech'' printed on the connector card so that you can tell it
  86.   actually is a Logitech mouse.
  87.  
  88.   There are also some truly ancient Microsoft mice (ones with ball
  89.   bearings on the bottom as well as the mouse ball and a DB9 connector)
  90.   which also use the Logitech protocol.
  91.  
  92.   2.4.  PS/2 mice.
  93.  
  94.   PS/2 mice aren't really bus mice at all.  The PS/2 mouse interface is
  95.   not on an expansion card, the mouse is connected to the PS/2 Auxiliary
  96.   Device port on the keyboard controller.  A PS/2 mouse port uses a
  97.   6-pin mini DIN connector, similar to the keyboard connector.  Many
  98.   laptops also use this kind of interface to their trackballs --- except
  99.   for the connector, of course.
  100.  
  101.   2.5.  ATI-XL mice.
  102.  
  103.   ATI-XL mice are a variant of Inport mice, with some slight
  104.   differences.  They come on the ATI-XL combined video adaptor/mouse
  105.   card.  Unless you know you have an ATI-XL card (and thus an ATI-XL
  106.   mouse), you probably don't have one of these. It is possible for ATI-
  107.   XL mice to use either the ATI-XL or Inport kernel drivers, although
  108.   the ATI-XL driver should give better results.
  109.  
  110.   2.6.  Mouse protocols.
  111.  
  112.   The PC world is full of different and conflicting mouse protocols.
  113.   Fortunately, the choice for bus mice is considerable smaller than that
  114.   for serial mice.  Most Inport, Logitech and ATI-XL mice use the
  115.   ``BusMouse'' protocol, although there are some ancient Logitech mice
  116.   which use the ``MouseSystems'' protocol, and some even older Microsoft
  117.   mice which use the Logitech protocol.  PS/2 mice use the ``PS/2''
  118.   protocol.
  119.  
  120.   3.  Getting your mouse working.
  121.  
  122.   Once you have figured out your mouse interface and protocol types,
  123.   you're ready to proceed.
  124.  
  125.   3.1.  Setting the mouse interrupt.
  126.  
  127.   Now, you'll need to know which interrupt number your mouse is using,
  128.   and make sure it doesn't conflict with any other peripherals you have
  129.   installed.
  130.  
  131.   You should make sure that your mouse is not trying to use the same
  132.   interrupt as any of your other devices --- it is not possible for the
  133.   mouse to share an interrupt under Linux, even though it may work fine
  134.   under other operating systems.  Check the documentation for all your
  135.   peripherals to see which interrupt they use.  In most cases IRQ4 is
  136.   used for the first serial port (/dev/ttyS0), IRQ3 for the second
  137.   (/dev/ttyS1) (these are assuming you actually have such devices --- if
  138.   you don't you can happily use their IRQ's), and IRQ5 for some SCSI
  139.   adaptors.
  140.  
  141.   Note that for ATI-XL, Inport and Logitech mice the kernel default is
  142.   to use IRQ5, so if you are stuck with a pre-compiled kernel (eg, CD-
  143.   ROM users) you will have to use that.
  144.  
  145.   3.2.  Inport and Logitech mice.
  146.  
  147.   If you open up your computer's case and look at the card which your
  148.   mouse plugs into, you should notice a block of jumpers on the card
  149.   (hopefully labeled ``INTERRUPT'') with positions for interrupt
  150.   (otherwise known as IRQ) numbers 2,3,4 and 5.  To change the interrupt
  151.   simply move the jumper from its current position onto the correct pair
  152.   of pins.
  153.  
  154.        ***************************************************
  155.        ***     MAKE SURE YOUR COMPUTER IS TURNED OFF   ***
  156.        ***     BEFORE CHANGING THE JUMPERS AROUND.     ***
  157.        ***************************************************
  158.  
  159.   3.3.  ATI-XL mice.
  160.  
  161.   ATI-XL busmice have a software selectable IRQ - you should have
  162.   received with your mouse a MS-DOS program (VSETUP.EXE) to set the IRQ.
  163.   In order to do so you must (temporarily) boot MS-DOS and run this
  164.   program.  Note that the VSETUP program takes an optional parameter
  165.   ``/70'' to increase the vertical refresh rate (which results in less
  166.   flicker).  The VSETUP program also allows you to select either the
  167.   primary or secondary mouse address - you should set this to the
  168.   primary address or the kernel will not be able to detect your mouse.
  169.  
  170.   Once VSETUP has been run you must perform a hard reset for the new
  171.   configuration to take effect.
  172.  
  173.   3.4.  PS/2 mice.
  174.  
  175.   The PS/2 mouse always uses IRQ12 -- there is no way of changing this
  176.   (except with a soldering gun.)  In the rare case that some other
  177.   device is using IRQ12, you'll have to rejumper that peripheral to use
  178.   another IRQ number.
  179.  
  180.   3.5.  Compiling the kernel.
  181.  
  182.   In order for your busmouse to operate correctly you will need to
  183.   recompile your kernel with the busmouse support compiled in.
  184.  
  185.   Change to your kernel directory (here assumed to be (/usr/src/linux)
  186.   and do a
  187.  
  188.        make config
  189.  
  190.   If you are unsure as to your mouse type, the first time you recompile
  191.   the kernel you may wish to enable all of the busmouse options in the
  192.   hope that the kernel will autodetect your mouse properly.  People have
  193.   mixed sucess with this: it doesn't always work, but on the other hand
  194.   it might save you any further compiles.
  195.  
  196.   3.5.1.  Inport, Logitech and ATI-XL mice.
  197.  
  198.   Answer ``y'' to the question pertaining to your type of busmouse
  199.   interface and ``n'' to all the other busmouse questions.  For example,
  200.   if you have an Inport mouse you should answer ``y'' to
  201.  
  202.        Microsoft busmouse support
  203.  
  204.   and ``n'' to all other busmouse questions.  Answer the non-mouse
  205.   related questions as you usually would.
  206.  
  207.   If you have a Logitech or Inport mouse, edit the file
  208.   /usr/src/linux/include/linux/busmouse.h and change the line which says
  209.  
  210.        #define MOUSE_IRQ               5
  211.  
  212.   to reflect the interrupt number for your mouse (see section ``setting
  213.   the mouse interrupt'' for details on finding your interrupt number).
  214.  
  215.   If you have an ATI-XL mouse, edit the file
  216.   /usr/src/linux/drivers/char/atixlmouse.c and change the line which
  217.   says
  218.  
  219.        #define ATIXL_MOUSE_IRQ         5
  220.  
  221.   to reflect your mouse's interrupt number.
  222.  
  223.   Due to the vagaries of the PC architecture, if you have set your mouse
  224.   to use interrupt 2, you must set the #define to use interrupt 9.
  225.  
  226.   Examples
  227.  
  228.   For a mouse on interrupt 3, you should change the line to read
  229.  
  230.        #define MOUSE_IRQ               3
  231.  
  232.   For a mouse on interrupt 2, you should change the line to read
  233.  
  234.        #define MOUSE_IRQ               9
  235.  
  236.   Next, compile your kernel as per the instructions which come with it,
  237.   and boot from the new kernel.  You should now have the busmouse
  238.   support correctly compiled in.
  239.  
  240.   3.5.2.  PS/2 mice.
  241.  
  242.   To compile the kernel with PS/2 mouse support answer ``y'' to the
  243.   question.
  244.  
  245.        PS/2 mouse (aka "auxiliary device") support
  246.  
  247.   The PS/2 mouse driver actually supports two kinds of devices: the
  248.   standard PS/2 Auxiliary Device controller and a special PS/2 mouse
  249.   interface chip from Chips & Technologies which is used in the Texas
  250.   Instruments Travelmate and Gateway Nomad laptops.  To compile in
  251.   support for the trackballs on these computers, answer ``y'' to the
  252.  
  253.        C&T 82C710 mouse port support (as on TI Travelmate)
  254.  
  255.   question.  Note that you will still have to answer ``y'' to the ques¡
  256.   tion about the standard PS/2 driver to even get a chance to answer
  257.   this question, since the 82C710 driver is actually an add-on to the
  258.   standard PS/2 mouse driver.
  259.  
  260.   When configured both for a standard PS/2 mouse device and the 82C710
  261.   device, the driver first tries to locate a 82C710 chip at boot time.
  262.   Failing this, the standard driver is used instead, so using a kernel
  263.   configured for both types of interface on a machine with a standard
  264.   PS/2 mouse port should work too.  However, there has been one report
  265.   of a falsely detected 82C710 chip, so to be on the safe side do not
  266.   configure in support for the 82C710 if you don't need it.
  267.  
  268.   Compile your new kernel and boot from it as you normally would.
  269.  
  270.   3.5.3.  Selection.
  271.  
  272.   Regardless of your mouse type you should answer ``y'' to the
  273.  
  274.        Selection (cut and paste for virtual consoles)
  275.  
  276.   question if you wish to run the selection program (see section
  277.   ``selection'' for more details).
  278.  
  279.   3.6.  The mouse devices.
  280.  
  281.   Mice under Linux are accessed via the devices in the /dev directory.
  282.   The following table gives a list of interface types and which device
  283.   you should use.
  284.  
  285.        INTERFACE        DEVICE        MAJOR    MINOR
  286.        ---------------------------------------------
  287.        Logitech        /dev/logibm      10       0
  288.        PS/2            /dev/psaux       10       1
  289.        Inport          /dev/inportbm    10       2
  290.        ATI-XL          /dev/atibm       10       3
  291.  
  292.            Table 1.  Mouse devices.
  293.  
  294.      Note:
  295.         If you are using your ATI-XL mouse with the Inport driver, you
  296.         should use the /dev/inportbm device, not the /dev/atibm device.
  297.  
  298.   The major and minor entries are the device numbers for that particular
  299.   device.
  300.  
  301.   If you find that you do not have these devices, you should create them
  302.   first.  To do so, execute the following as root.
  303.  
  304.        mknod /dev/logibm   c 10 0
  305.        mknod /dev/psaux    c 10 1
  306.        mknod /dev/inportbm c 10 2
  307.        mknod /dev/atibm    c 10 3
  308.  
  309.      Note:
  310.         Some time in the (progressively less) recent history of Linux
  311.         the names for the busmouse devices have changed.  The following
  312.         device names have been superceded by those above and should be
  313.         removed: bmousems, bmouseps2, bmouseatixl, bmouselogitech.
  314.  
  315.   Many people like to create a symbolic link from their mouse device to
  316.   /dev/mouse so that they don't have to remember which device they need
  317.   to be using.  If you have one of the current Linux distributions you
  318.   will almost certainly find that you have such a link.  If you have
  319.   such a link, or create one, you should make sure that it is pointing
  320.   to the correct device for your mouse.
  321.  
  322.   3.7.  Testing your mouse.
  323.  
  324.   Get the file selection-1.6.tar.gz from your local Linux ftp site and
  325.   compile the program ``test-mouse'' within it, according to the
  326.   instructions (all you should need to do is type ``make test-mouse'').
  327.   Run the program like this
  328.  
  329.        test-mouse -t <mouse arg> -m <mouse dev>
  330.  
  331.   where <mouse arg> is ``bm'' (without the quotes) if you use the Bus¡
  332.   Mouse protocol, or ``ps2'' if you use the PS/2 protocol, and <mouse
  333.   dev> is your mouse device name from table 1.
  334.  
  335.   If your mouse is working correctly, you should be able to paint on the
  336.   screen by holding down the right or left mouse button and dragging the
  337.   mouse.  Push the left and right mouse buttons simultaneously to exit
  338.   the program.
  339.  
  340.   4.  Using your mouse.
  341.  
  342.   4.1.  Selection.
  343.  
  344.   Selection is a program which allows you to do mouse based 'cut- and-
  345.   paste' between virtual consoles under Linux.  Selection can be found
  346.   as the file selection-1.6.tar.gz at your friendly Linux FTP site (such
  347.   as sunsite.unc.edu), and contains instructions for getting it
  348.   compiled.  Some Linux distributions, such as Slackware, come with a
  349.   precompiled selection binary.
  350.  
  351.   When invoking selection, use the -t switch to selection to indicate
  352.   which protocol your mouse is using and the -m option to indicate which
  353.   mouse device you are using.  The default is to use the /dev/mouse
  354.   device, so you can omit the -m option if you have the appropriate
  355.   symbolic link. For example, if you use the BusMouse protocol,
  356.   selection should be run like this:
  357.  
  358.        selection -t bm
  359.  
  360.   or if you use the PS/2 protocol:
  361.  
  362.        selection -t ps2
  363.  
  364.   You should then be able to cut and paste text between virtual consoles
  365.   using the mouse buttons.  Read the documentation with selection, or do
  366.   a ``man selection'' for more information on how to operate it.
  367.  
  368.   There have been a couple of reports of selection not working correctly
  369.   with certain laptop trackballs (under the PS/2 interface).  Replacing
  370.   the line
  371.  
  372.        { 0xcc,   0x00,   0x00,   0x00,   3       }   /* PS/2 */
  373.  
  374.   in selection's mouse.c file with the line
  375.  
  376.        { 0xcc,   0x08,   0x00,   0x00,   3       }   /* PS/2 */
  377.  
  378.   may help if you are having problems and can't track it down to any¡
  379.   thing else.
  380.  
  381.   4.2.  XFree86.
  382.  
  383.   To use your busmouse under XFree86, you will need to set your mouse
  384.   protocol type in your Xconfig file. If you have a BusMouse protocol
  385.   mouse, your Xconfig should contain (including the quotes)
  386.  
  387.        Busmouse        "/dev/mouse"
  388.  
  389.   For PS/2 mice it should have
  390.  
  391.        ps/2        "/dev/mouse"
  392.  
  393.   If you have a two button mouse, it should also contain the line
  394.  
  395.        Emulate3Buttons
  396.  
  397.   which will allow you to emulate the use of the middle mouse button by
  398.   pressing both mouse buttons simultaneously.  All other mouse related
  399.   lines, such as ``BaudRate'' and ``SampleRate'' should be commented
  400.   out, as these have no effect on bus mice.
  401.  
  402.   4.3.  XFree86 and selection.
  403.  
  404.   Unlike serial mice, you cannot share busmice between processes.  This
  405.   means you will have to kill any copies of ``selection'' (see section
  406.   ``selection'') you have running before you start up Xfree86.  If you
  407.   try to run X with selection running, you will get errors like the
  408.   following
  409.  
  410.        Fatal server error:
  411.        Cannot open mouse (Device or resource busy)
  412.  
  413.   Version 1.6 of selection allows you to terminate running copies of
  414.   selection by executing
  415.        selection -k
  416.  
  417.   This should be done before starting up X11.  You may wish to add a
  418.   line containing the above command to the top of your startx script so
  419.   that the mouse is shut down automatically.  If you have an older ver¡
  420.   sion of selection which does not support the -k switch you will have
  421.   to kill selection by hand.
  422.  
  423.   5.  Still can't get your mouse going?
  424.  
  425.   So you've read through this howto a dozen times, done everything
  426.   exactly as you think you should have, and your mouse still doesn't
  427.   work?  The best advice I can give you is this: experiment.  Sure, it's
  428.   a pain in the posterior, but in the end the only way to find out what
  429.   is going to work with your mouse is to try all of the alternatives
  430.   until you have success.
  431.  
  432.   As always, if there is something you don't understand, try reading the
  433.   manual page first and see if that helps.  If you have a specific
  434.   question, or a problem you think I might be able to help with, feel
  435.   free to contact me at the address listed at the top of this howto, and
  436.   I'll see if I can help you out or point you to someone who can.
  437.  
  438.   The comp.os.linux.help newsgroup is the appropriate forum for
  439.   discussion and/or questions regarding mice --- please don't post
  440.   questions to other groups, and especially don't crosspost questions to
  441.   two or more of the Linux groups, they are more than cluttered enough
  442.   as it is!  When posting, you will get a much better response (and much
  443.   fewer flames) if you use appropriate Subject: and Keywords: lines.
  444.   For example:
  445.  
  446.        Subject: BUSMICE - Gateway 2000 mouse wont work.
  447.        Keywords: mouse busmouse gateway
  448.  
  449.